package com.xiaoyu.lanling.feature.fate.widget

import android.text.TextPaint
import android.text.style.ClickableSpan
import android.view.View
import com.xiaoyu.base.app.App
import com.xiaoyu.base.app.AppContext
import com.xiaoyu.base.model.User
import com.xiaoyu.lanling.R
import com.xiaoyu.lanling.router.Router

class TvClickSpan(val user: User) : ClickableSpan() {
    override fun onClick(widget: View) {
        val topActivity = App.getInstance().topActivity ?: return
        Router.instance.gotoUserActivity(topActivity, user)
    }

    override fun updateDrawState(ds: TextPaint) {
        super.updateDrawState(ds)
        ds.color = AppContext.getColor(R.color.colorSecondaryDark)
        ds.isUnderlineText = false
    }
}